Release 10.1A: OpenEdge Getting Started:
Object-oriented Programming


Comparison with procedure-based programming

There is no expectation that you will convert existing procedural Progress applications to use classes unless you have a reason to do so. The language statements supporting classes provide new capabilities as any new language constructs do, and you can choose to take advantage of these new constructs when they are beneficial to you. This section summarizes and compares a few key differences between using procedures and using classes in your development.

When multiple procedures need to access the data in a temp-table or a ProDataSet, the temp-table or the ProDataSet and its temp-tables are routinely defined in an include file and included in all procedures that need access to the temp table or ProDataSet. In this way the definitions only need to be written once and you have assurance that the definitions are consistent between all the procedures that use them, and that a change to the definitions is propagated to all procedures that use them simply by recompiling them. The temp-table or ProDataSet can then be passed between the procedures as a parameter. Other documentation describes how to pass both ProDataSets and temp-tables by reference, so that they are not copied from one procedure to another (see OpenEdge Development: Progress 4GL Handbook ).

Within a class hierarchy a super class can define a PROTECTED temp-table or ProDataSet whose definition is implicitly shared among all the subclasses of that super class. There is no need to repeat the definition in each subclass. (Indeed, it would be a compiler error to repeat the definition). If the methods that access the common data held in a temp-table or ProDataSet are all in the same class hierarchy, then they can all access the data through its one PROTECTED definition, without the need to pass the temp-table or ProDataSet as a parameter.

Similarly, variables and other data definitions that might be defined as SHARED in procedure-based Progress applications can be defined as PROTECTED within a class hierarchy. However, note that classes cannot define or access the SHARED variables used by procedures.

Also, you cannot use a class (either source or r-code) as a startup routine specified by the Startup Procedure (-p) startup parameter. You can only use a procedure for this purpose.


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095